home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / GadUtil / Examples / MoreExamples-C / Window_Test.c < prev    next >
C/C++ Source or Header  |  1997-10-05  |  19KB  |  473 lines

  1. /*
  2.            project: gadutil example - 8 Color gadgets + PROGRESS_KIND usage.
  3.             author: Staffan Hämälä
  4.             e-mail: staham@algonet.se
  5.  
  6.                      Compiled with StormC version 1.05 DEMO. Now SAS/C V6.0.
  7.  
  8.                      Use MagicWB colors on WB to get the gadgets right..
  9.  
  10.                      Push the gadgets for progress up / down.
  11.  
  12. */
  13. /*-----------------------------------------------------------------------*/
  14. /*
  15. Since every C program usually has header files included, so we here include
  16. needed files to satisfy our compiler !
  17. */
  18. #include <proto/exec.h>
  19. #include <proto/intuition.h>
  20. #include <intuition/gadgetclass.h>
  21. #include <libraries/gadutil.h>
  22. #include <proto/gadtools.h>
  23. #include <proto/gadutil.h>          /* the name of the game ! */
  24. /*-----------------------------------------------------------------------*/
  25. /*
  26. It's  very useful to define absolute gadget's position in the window. Note:
  27. it's only for the first gadget - other gadgets may be positioned relatively
  28. each  to other. Also these values are used to compute the right size of the
  29. window  (see  tags WA_InnerWidth and WA_InnerHeight). It means that gadutil
  30. will compute for you the final size of the window !
  31. */
  32. #define LEFT_OFFSET        10
  33. #define TOP_OFFSET        10
  34.  
  35. /*
  36. The  following  variables  will  be  further  filled  by  gadutil  internal
  37. routines. Aren't ya familar with these yet ? Just refer to gadutil autodocs
  38. and it'll becomes clear at once !
  39. */
  40. LONG farright, farbottom, gad_IDCMP;
  41.  
  42. struct TagItem global_tags[] =
  43. {
  44.   GU_RightExtreme, (ULONG)&farright,
  45.   GU_LowerExtreme, (ULONG)&farbottom,
  46.   GU_MinimumIDCMP, (ULONG)&gad_IDCMP,
  47.   TAG_DONE
  48. };
  49.  
  50. /*-----------------------------------------------------------------------*/
  51. /*
  52. Gadget Image data
  53. */
  54.  
  55. /* #pragma chip*/    /* StormC specific. SAS/C uses "static UWORD __chip myData.." */
  56.  
  57. /* Image data for Gadget 2 Unselected */
  58.  
  59. static UWORD __chip myData2[] =
  60. {
  61.     0x0000,0x0000,0x0000,0x0600,0x2abf,0xaaaa,0xaaaa,0xae00,
  62.     0x557f,0xd555,0x5555,0x5600,0x2aff,0xeaa9,0x2aaa,0xae00,
  63.     0x557b,0xf152,0x9555,0x5600,0x2aff,0xffad,0x6aaa,0xae00,
  64.     0x557f,0x7fda,0xa555,0x5600,0x2aff,0xfae7,0x5aaa,0xae00,
  65.     0x557a,0xff4a,0xad55,0x5600,0x2afd,0xfff4,0x56aa,0xae00,
  66.     0x557f,0xff2a,0x2b55,0x5600,0x2abb,0x7fd5,0x95d6,0xae00,
  67.     0x555f,0xe02b,0x5afb,0x5600,0x2aaf,0xde54,0xad76,0xae00,
  68.     0x5555,0xf6ab,0x56bb,0x5600,0x2aab,0x8f56,0xebde,0xae00,
  69.     0x5554,0xd8ab,0xd5ed,0x5600,0x2aab,0xfc56,0xab16,0xae00,
  70.     0x5555,0x6e2a,0x56ab,0x5600,0x2aaa,0xef46,0x2d65,0xae00,
  71.     0x5554,0xff47,0x1a56,0x5600,0x2aab,0xfefb,0x94aa,0xae00,
  72.     0x555f,0x5eff,0xa955,0x5600,0x2aae,0xadff,0x52aa,0xae00,
  73.     0x5575,0x55ff,0x8d55,0x5600,0x2aaa,0xabcb,0x52aa,0xae00,
  74.     0x5555,0x5555,0x4955,0x5600,0x2aaa,0xaaaa,0xa5aa,0xae00,
  75.     0xffff,0xffff,0xffff,0xfe00,0xffff,0xffff,0xffff,0xfe00,
  76.     0xffff,0xffff,0xffff,0xfa00,0xaaa0,0x2aaa,0xaaaa,0xaa00,
  77.     0xd548,0x1554,0x5555,0x5200,0xaaa0,0x0aab,0xaaaa,0xaa00,
  78.     0xd52f,0x1757,0xd555,0x5200,0xaa8d,0x97a7,0xcaaa,0xaa00,
  79.     0xd517,0x9ddf,0xe555,0x5200,0xaa8d,0x9afd,0xfaaa,0xaa00,
  80.     0xd502,0xdf7d,0xfd55,0x5200,0xaac5,0xbf5e,0xfeaa,0xaa00,
  81.     0xd567,0x807f,0x7f55,0x5200,0xaaa7,0x7fff,0xbfbe,0xaa00,
  82.     0xd542,0xa0fe,0x5faf,0x5200,0xaaa7,0x5bfe,0xa7dc,0xaa00,
  83.     0xd555,0x37ff,0x59ef,0x5200,0xaaab,0x8dfc,0xbe76,0xaa00,
  84.     0xd554,0xdffd,0x7eb9,0x5200,0xaaab,0xfbfd,0xfdfe,0xaa00,
  85.     0xd555,0x65fd,0xfbff,0x5200,0xaaaa,0x26bd,0xf3ee,0xaa00,
  86.     0xd554,0xfffb,0xe753,0x5200,0xaaa9,0xffff,0xeeaa,0xaa00,
  87.     0xd55e,0x5ff3,0xdd55,0x5200,0xaaae,0xa7ff,0xfaaa,0xaa00,
  88.     0xd565,0x53ef,0xd555,0x5200,0xaaaa,0xa9cb,0x7aaa,0xaa00,
  89.     0xd555,0x5555,0x5d55,0x5200,0xaaaa,0xaaaa,0xaeaa,0xaa00,
  90.     0x0000,0x0000,0x0000,0x0200,0xffff,0xffff,0xffff,0xfe00,
  91.     0x0000,0x0000,0x0000,0x0400,0x5540,0x5555,0x5555,0x5000,
  92.     0x2a80,0x2aab,0xaaaa,0xa800,0x5500,0x1555,0x5555,0x5000,
  93.     0x2a84,0x0eaa,0xaaaa,0xa800,0x5509,0x0f5d,0x7555,0x5000,
  94.     0x2a87,0x9faa,0xaaaa,0xa800,0x550f,0x9bd7,0x5555,0x5000,
  95.     0x2a87,0x9fea,0xaaaa,0xa800,0x5503,0xbff5,0x5555,0x5000,
  96.     0x2a87,0xffea,0xaaaa,0xa800,0x5543,0xffd5,0x5555,0x5000,
  97.     0x2aa7,0xf0ab,0xbafa,0xa800,0x5553,0xff55,0x5d77,0x5000,
  98.     0x2aa9,0xfeaa,0xb6ba,0xa800,0x5555,0xdf57,0x6bdd,0x5000,
  99.     0x2aaa,0xfcaa,0xd5ee,0xa800,0x5554,0xec56,0xab55,0x5000,
  100.     0x2aaa,0x7e2a,0x56ea,0xa800,0x5555,0xff46,0x2d55,0x5000,
  101.     0x2aaa,0xef47,0x1a2e,0xa800,0x5557,0xceff,0x9555,0x5000,
  102.     0x2abf,0xaeff,0xeaaa,0xa800,0x556d,0x5df7,0xd555,0x5000,
  103.     0x2aba,0xadf7,0x8aaa,0xa800,0x5555,0x57d7,0x5555,0x5000,
  104.     0x2aaa,0xaaaa,0xaaaa,0xa800,0x5555,0x5555,0x5555,0x5000,
  105.     0x8000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  106. };
  107.  
  108.  
  109. /* Image data for Gadget 2 Selected */
  110.  
  111. static UWORD __chip myData2b[] =
  112. {
  113.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0200,
  114.     0x155f,0xd555,0x5555,0x5600,0x2abf,0xeaaa,0xaaaa,0xaa00,
  115.     0x157f,0xf554,0xe555,0x5600,0x2abd,0xf8a9,0x5555,0x7e00,
  116.     0x157f,0xffd6,0xaaaa,0xaa00,0x2abf,0xbfed,0x5557,0x7a00,
  117.     0x157f,0xfd73,0xaac5,0x9600,0x2abd,0x7fa5,0xf0aa,0xaa00,
  118.     0x157e,0xfffa,0x9555,0x5600,0x2abf,0xff95,0x2aaa,0xaa00,
  119.     0x155d,0xbfea,0xd56b,0x5600,0x2aaf,0xf015,0xabbd,0xaa00,
  120.     0x1557,0xef2a,0x555b,0x5600,0x2aaa,0xfb55,0xaab5,0xaa00,
  121.     0x1555,0xc7ab,0x756b,0x5600,0x2aaa,0x6c55,0xead6,0xaa00,
  122.     0x1555,0xfe2b,0x55ad,0x5600,0x2aaa,0xb715,0x2b5a,0xaa00,
  123.     0x1555,0x77a3,0x16b5,0x5600,0x2aaa,0x7fa3,0x8d2a,0xaa00,
  124.     0x1555,0xff7d,0xca55,0x5600,0x2aaf,0xaf7f,0xd4aa,0xaa00,
  125.     0x1557,0x56ff,0xa955,0x5600,0x2aba,0xaaff,0xc6aa,0xaa00,
  126.     0x1555,0x55e5,0xa955,0x5600,0x2aaa,0xaaaa,0xa4aa,0xaa00,
  127.     0x1555,0x5555,0x52d5,0x5600,0x7fff,0xffff,0xffff,0xfe00,
  128.     0x0000,0x0000,0x0000,0x0000,0x7fff,0xffff,0xffff,0xfc00,
  129.     0x5550,0x1555,0x5555,0x5400,0x6aa4,0x0aaa,0xaaaa,0xa800,
  130.     0x5550,0x0555,0xa555,0x5400,0x6a97,0x8bab,0xffff,0xc800,
  131.     0x5546,0xcbd3,0xffff,0xfc00,0x6a8b,0xceef,0xfffd,0xf000,
  132.     0x5546,0xcd7e,0xff45,0xd400,0x6a81,0x6fbf,0x00aa,0xa800,
  133.     0x5562,0xdfaf,0x9555,0x5400,0x6ab3,0xc03f,0xaaaa,0xa800,
  134.     0x5553,0xbfff,0xd51f,0x5400,0x6aa1,0x507f,0x2af7,0xa800,
  135.     0x5553,0xadff,0x57ee,0x5400,0x6aaa,0x9bff,0xafdf,0xa800,
  136.     0x5555,0xc6fe,0x5fbf,0x5400,0x6aaa,0x6ffe,0xbf7e,0xa800,
  137.     0x5555,0xfdfe,0xfefd,0x5400,0x6aaa,0xb2fe,0xfdfa,0xa800,
  138.     0x5555,0x135e,0xf9f5,0x5400,0x6aaa,0x7ffd,0xf3aa,0xa800,
  139.     0x5554,0xffff,0xf755,0x5400,0x6aaf,0x2ff9,0xeeaa,0xa800,
  140.     0x5557,0x53ff,0xfd55,0x5400,0x6ab2,0xa9f7,0xeaaa,0xa800,
  141.     0x5555,0x54e5,0xbd55,0x5400,0x6aaa,0xaaaa,0xaeaa,0xa800,
  142.     0x5555,0x5555,0x5755,0x5400,0x0000,0x0000,0x0000,0x0000,
  143.     0xffff,0xffff,0xffff,0xfe00,0x8000,0x0000,0x0000,0x0200,
  144.     0xaaa0,0x2aaa,0xaaaa,0xa800,0x9540,0x1555,0x5555,0x5400,
  145.     0xaa80,0x0aaa,0xfaaa,0xa800,0x9542,0x0755,0x5555,0x7400,
  146.     0xaa84,0x87ae,0xaaaa,0xa800,0x9543,0xcfd5,0x5557,0x7800,
  147.     0xaa87,0xcdeb,0xaada,0x8800,0x9543,0xcff5,0xf355,0x5400,
  148.     0xaa81,0xdffa,0xaaaa,0xa800,0x9543,0xfff5,0x5555,0x5400,
  149.     0xaaa1,0xffea,0xaaea,0xa800,0x9553,0xf855,0xd5bd,0x5400,
  150.     0xaaa9,0xffaa,0xa95b,0xa800,0x9554,0xff55,0x5ab5,0x5400,
  151.     0xaaaa,0xefab,0xb56a,0xa800,0x9555,0x7e55,0x6ad5,0x5400,
  152.     0xaaaa,0x762b,0x55aa,0xa800,0x9555,0x3f15,0x2b55,0x5400,
  153.     0xaaaa,0xffa3,0x16aa,0xa800,0x9555,0x77a3,0x8d15,0x5400,
  154.     0xaaab,0xe77f,0xcaaa,0xa800,0x955f,0xd77f,0xf555,0x5400,
  155.     0xaab6,0xaefb,0xeaaa,0xa800,0x955d,0x56fb,0xc555,0x5400,
  156.     0xaaaa,0xabeb,0xaaaa,0xa800,0x9555,0x5555,0x5555,0x5400,
  157.     0xaaaa,0xaaaa,0xaaaa,0xa800,0xc000,0x0000,0x0000,0x0000,
  158. };
  159.  
  160. /* Image data for Gadget 3 Unselected */
  161.  
  162. static UWORD __chip myData3[] =
  163. {
  164.     0x0000,0x0000,0x0080,0x0600,0x7fff,0xffff,0xf07f,0xfe00,
  165.     0x7fff,0xffff,0xe03f,0xfe00,0x7f87,0xffff,0xc43b,0xfe00,
  166.     0x2e7b,0xaeae,0x8a73,0xae00,0x7dfd,0xffff,0x15c1,0xfe00,
  167.     0x2dae,0xeaaa,0x2f09,0xae00,0x5bde,0xdddc,0x5c30,0xde00,
  168.     0x2baa,0xeaa8,0xb0cc,0xee00,0x1b10,0xd110,0x4330,0x5600,
  169.     0x2bab,0xebff,0xffff,0xee00,0x0b02,0xc000,0x0000,0x0600,
  170.     0x0b88,0x8854,0x0000,0x1e00,0x0b00,0x1068,0x0001,0x1e00,
  171.     0x1fff,0xf854,0x0000,0x1e00,0x1a00,0x3800,0x0003,0x9e00,
  172.     0x1d00,0x3800,0x0001,0x9e00,0x1a38,0x3800,0x0000,0x1e00,
  173.     0x1d38,0x3800,0x3780,0x1e00,0x1a38,0x3800,0x0000,0x1e00,
  174.     0x1c10,0x3800,0x2fe8,0x1e00,0x1a38,0x3800,0x0000,0x1e00,
  175.     0x1c7c,0x3800,0x2db0,0x1e00,0x1a00,0x3800,0x0000,0x1e00,
  176.     0x1c00,0x3800,0x0000,0x1e00,0x1fff,0xf800,0x0000,0x1e00,
  177.     0x1fff,0xf9ff,0xffff,0xfe00,0x0fff,0xf8ff,0xffff,0xfe00,
  178.     0xffff,0xffff,0xffff,0xfe00,0xffff,0xffff,0xffff,0xfe00,
  179.     0xffff,0xffff,0xff7f,0xfa00,0x8000,0x0000,0x0f80,0x0200,
  180.     0x8078,0x0000,0x1fc0,0x0200,0x81f8,0x0000,0x3bc4,0x0200,
  181.     0x8384,0x0000,0x758d,0x0200,0x8682,0x0000,0xea3e,0x0200,
  182.     0x8701,0x4001,0xd0f6,0x8200,0x8c03,0x0003,0xa3cf,0x0200,
  183.     0x8c03,0x0007,0x4f33,0x4200,0x8c01,0x000f,0xbccf,0x8200,
  184.     0x8c00,0x0000,0x0000,0x0200,0x8c03,0x01ff,0xffff,0xe200,
  185.     0x8c00,0x01ab,0xffff,0xf200,0x8c00,0x1197,0xffff,0xea00,
  186.     0x9fff,0xe9ab,0xffff,0xea00,0x95fd,0x29ff,0xffff,0xea00,
  187.     0x92fe,0xa9ff,0xffff,0xea00,0x95ed,0x29ff,0xffff,0xea00,
  188.     0x92c6,0xa9ff,0xf27f,0xea00,0x95ed,0x29ff,0xffff,0xea00,
  189.     0x93c6,0xa9ff,0xe4a7,0xea00,0x95c5,0x29ff,0xffff,0xea00,
  190.     0x93c6,0xa9ff,0xe48f,0xea00,0x95fd,0x29ff,0xffff,0xea00,
  191.     0x93fa,0x29ff,0xffff,0xea00,0x9fff,0xe9ff,0xffff,0xea00,
  192.     0x9000,0x0980,0x0000,0x0a00,0x8fff,0xf8ff,0xffff,0xfa00,
  193.     0x0000,0x0000,0x0000,0x0200,0xffff,0xffff,0xffff,0xfe00,
  194.     0x0000,0x0000,0x0000,0x0400,0x7fff,0xffff,0xf03f,0xf800,
  195.     0x7f87,0xffff,0xe01f,0xf800,0x7e01,0xffff,0xc429,0xf800,
  196.     0x2c7a,0xaeae,0x8a72,0xa800,0x7905,0x7fff,0x15c0,0xf800,
  197.     0x282a,0x2aaa,0x2f09,0x2800,0x52dc,0x9ddc,0x5c30,0x5800,
  198.     0x22a8,0xaaa8,0xb0cc,0xa800,0x1212,0x9110,0x4330,0x1000,
  199.     0x22ab,0xabff,0xffff,0xe800,0x0200,0x8000,0x0000,0x0000,
  200.     0x0288,0x8854,0x0000,0x0800,0x32ff,0xe068,0x0003,0x8000,
  201.     0x3fff,0xc054,0x0003,0x8000,0x3fff,0xc000,0x0001,0x8000,
  202.     0x3fff,0xc000,0x0003,0x0000,0x3fc7,0xc000,0x0000,0x0000,
  203.     0x7fc7,0xc400,0x0d80,0x0000,0x3fc7,0xc200,0x0000,0x0000,
  204.     0x7fef,0xc400,0x1b58,0x0000,0x3fc7,0xc200,0x0000,0x0000,
  205.     0x7f83,0xc400,0x1b70,0x0000,0x3fff,0xc200,0x0000,0x0000,
  206.     0x7fff,0xc400,0x0000,0x0000,0x7000,0x0600,0x0000,0x0000,
  207.     0x6000,0x0600,0x0000,0x0000,0x7000,0x0700,0x0000,0x0000,
  208.     0x8000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,
  209. };
  210.  
  211.  
  212.  
  213.  
  214. /* Image data for Gadget 3 Selected */
  215.  
  216. static UWORD __chip myData3b[] =
  217. {
  218.     0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0200,
  219.     0x3fff,0xffff,0xffff,0xfe00,0x3fff,0xffff,0xffff,0xfe00,
  220.     0x3fff,0xffff,0xffff,0xfe00,0x177f,0x5757,0x5fd7,0x5600,
  221.     0x3fc3,0xffff,0xffff,0xfe00,0x153d,0xd555,0x7ff5,0x5600,
  222.     0x2efe,0xeeee,0xfffe,0xee00,0x16d7,0x7555,0xff7d,0x5600,
  223.     0x0d89,0x688b,0xfff8,0x8a00,0x15d5,0x75ff,0xffff,0xf600,
  224.     0x0581,0x600d,0xeb60,0x0200,0x05c5,0x641b,0xf6c0,0x0e00,
  225.     0x0581,0x6836,0x7d80,0x8e00,0x0fff,0xfc1b,0x4b00,0x0e00,
  226.     0x0d00,0x1c0d,0x8601,0xce00,0x0e80,0x1c06,0xcc00,0xce00,
  227.     0x0d1c,0x1c03,0x7800,0x0e00,0x0e9c,0x1c01,0xbbc0,0x0e00,
  228.     0x0d1c,0x1c00,0xe000,0x0e00,0x0e08,0x1c00,0x57f4,0x0e00,
  229.     0x0d1c,0x1c00,0x0000,0x0e00,0x0e3e,0x1c00,0x16d8,0x0e00,
  230.     0x0d00,0x1c00,0x0000,0x0e00,0x0e00,0x1c00,0x0000,0x0e00,
  231.     0x0fff,0xfc00,0x0000,0x0e00,0x0fff,0xfcff,0xffff,0xfe00,
  232.     0x07ff,0xfc7f,0xffff,0xfe00,0x7fff,0xffff,0xffff,0xfe00,
  233.     0x0000,0x0000,0x0000,0x0000,0x7fff,0xffff,0xffff,0xfc00,
  234.     0x4000,0x0000,0x0000,0x0000,0x4000,0x0000,0x0200,0x0000,
  235.     0x4000,0x0000,0x0500,0x0000,0x403c,0x0000,0x0880,0x0000,
  236.     0x40fe,0x0000,0x1140,0x0000,0x41c2,0x0000,0x2060,0x0000,
  237.     0x4341,0x0000,0x4110,0x0000,0x4380,0xa000,0x8008,0x0000,
  238.     0x4601,0x8001,0x0010,0x0000,0x4601,0x8002,0x0060,0x0000,
  239.     0x4601,0x80f6,0x14df,0xf000,0x4601,0x80ec,0x09bf,0xf800,
  240.     0x4601,0x88d9,0x837f,0xf400,0x4fff,0xf4ec,0x36ff,0xf400,
  241.     0x4afe,0x94f6,0x7dff,0xf400,0x497f,0x54fb,0x3bff,0xf400,
  242.     0x4af6,0x94fd,0x97ff,0xf400,0x4963,0x54fe,0xe93f,0xf400,
  243.     0x4af6,0x94ff,0x5fff,0xf400,0x49e3,0x54ff,0xb253,0xf400,
  244.     0x4ae2,0x94ff,0xffff,0xf400,0x49e3,0x54ff,0xf247,0xf400,
  245.     0x4afe,0x94ff,0xffff,0xf400,0x49fd,0x14ff,0xffff,0xf400,
  246.     0x4fff,0xf4ff,0xffff,0xf400,0x4800,0x04c0,0x0000,0x0400,
  247.     0x47ff,0xfc7f,0xffff,0xfc00,0x0000,0x0000,0x0000,0x0000,
  248.     0xffff,0xffff,0xffff,0xfe00,0x8000,0x0000,0x0000,0x0200,
  249.     0xbfff,0xffff,0xfdff,0xfc00,0xbfff,0xffff,0xfaff,0xfc00,
  250.     0xbfff,0xffff,0xf77f,0xfc00,0x9743,0x5757,0x4c97,0x5400,
  251.     0xbf00,0xffff,0xd85f,0xfc00,0x943d,0x5555,0x3325,0x5400,
  252.     0xac82,0xaeee,0x7876,0xec00,0x9415,0x1554,0xcc79,0x5400,
  253.     0x8908,0x4889,0x9a70,0x8800,0x9154,0x55fb,0xb12f,0xf400,
  254.     0x8100,0x4004,0x0940,0x0000,0x8144,0x4408,0x8080,0x0400,
  255.     0x997e,0x5010,0x2101,0xc000,0x9fff,0xe008,0x8a01,0xc000,
  256.     0x9fff,0xe004,0x0400,0xc000,0x9fff,0xe002,0x0801,0x8000,
  257.     0x9fe3,0xe001,0x3000,0x0000,0xbfe3,0xe200,0xa6c0,0x0000,
  258.     0x9fe3,0xe100,0x4000,0x0000,0xbff7,0xe200,0x0dac,0x0000,
  259.     0x9fe3,0xe100,0x0000,0x0000,0xbfc1,0xe200,0x0db8,0x0000,
  260.     0x9fff,0xe100,0x0000,0x0000,0xbfff,0xe200,0x0000,0x0000,
  261.     0xb800,0x0300,0x0000,0x0000,0xb000,0x0300,0x0000,0x0000,
  262.     0xb800,0x0380,0x0000,0x0000,0xc000,0x0000,0x0000,0x0000,
  263. };
  264.  
  265.  
  266.  
  267. /*#pragma fast*/        /* StormC specific. SAS/C uses "static UWORD __chip myData.." */
  268.  
  269.  
  270. /*-------------------------------------------------------------------------*/
  271.  
  272. struct Image image2 = {0, 0, 55, 30, 3, myData2, 0x07, 0x00, NULL};
  273. struct Image image2b = {0, 0, 55, 30, 3, myData2b, 0x07, 0x00, NULL};
  274. struct Image image3 = {0, 0, 55, 30, 3, myData3, 0x07, 0x00, NULL};
  275. struct Image image3b = {0, 0, 55, 30, 3, myData3b, 0x07, 0x00, NULL};
  276.  
  277.  
  278. /*-----------------------------------------------------------------------*/
  279. /*
  280. Here we can define all gadgets ! It's very simple task - you don't need any
  281. GUI  editor  since  gadget's  positions may be specified relatively each to
  282. other !
  283. */
  284.  
  285. /* gadget's names
  286. */
  287. #define GDG_ONTIME   1        /* Specify a name for the gadgets (GadgetID) */
  288. #define GDG_BUTTON2  2
  289. #define GDG_BUTTON3  3
  290.  
  291.  
  292. struct TagItem ontime[] =
  293. {
  294.   GU_GadgetKind,  PROGRESS_KIND,    /* The gadget type */
  295.   GU_GadgetText,  (ULONG)"",            /* No text!                 */
  296.   GU_Left,               LEFT_OFFSET,
  297.   GU_Top,                 TOP_OFFSET,
  298.     GU_Height,            10,
  299.     GU_AlignRight,    GDG_BUTTON3,
  300.     GUPR_FillColor,    7,                            /* Fill color for the progress gadget */
  301.     GUPR_BackColor,    0,                            /* Background color for the progress gadget */
  302.     GUPR_Current,        75,                            /* Current position */
  303.     GUPR_Total,            100,                        /* Max value. ie. 100% */
  304.   TAG_DONE
  305. };
  306.  
  307. struct TagItem button2[] =
  308. {
  309.   GU_GadgetKind,  IMAGE_KIND,            /* Image kind gadget.. 8 Color image */
  310.   GU_GadgetText,  (ULONG)"",
  311.   GU_Left,                LEFT_OFFSET,
  312.   GU_TopRel,            GDG_ONTIME,
  313.     GU_Height,            32,
  314.     GU_Width,                59,
  315.     GUIM_Image,            (ULONG)&image2,    /* Normal image */
  316.     GUIM_SelectImg,    (ULONG)&image2b,/* And selected image */
  317.     TAG_DONE
  318. };
  319.  
  320. struct TagItem button3[] =
  321. {
  322.   GU_GadgetKind,  IMAGE_KIND,            /* Another 8 color gadget */
  323.   GU_GadgetText,  (ULONG)"",
  324.   GU_LeftRel,            GDG_BUTTON2,
  325.   GU_AlignTop,        GDG_BUTTON2,
  326.     GU_Height,            32,
  327.     GU_Width,                59,
  328.     GUIM_Image,            (ULONG)&image3,    /* Normal image */
  329.     GUIM_SelectImg,    (ULONG)&image3b,/* Selected image */
  330.     TAG_DONE
  331. };
  332.  
  333.  
  334.  
  335. /* This is the list of the gadgets. To remove a gadget, just remove a line :-) */
  336.  
  337. struct LayoutGadget gadgets[] =
  338. {
  339.   GDG_ONTIME,        ontime,        NULL,        NULL,
  340.   GDG_BUTTON2,    button2,    NULL,        NULL,
  341.   GDG_BUTTON3,    button3,    NULL,        NULL,
  342.   -1
  343. };
  344. /*-----------------------------------------------------------------------*/
  345. struct Library *GadUtilBase = NULL;  /* library base */
  346. struct Screen *myscreen     = NULL;  /* our screen */
  347. struct Window *mywindow     = NULL;  /* and its visitor window */
  348.  
  349. struct ProgressGad *gadgetaddr;             /* Progress gadget pointer */
  350.  
  351. APTR ginfo;                          /* gadget stuff */
  352. struct Gadget *glist;
  353. UWORD sel_gadID;                     /* number of the selected gadget */
  354.  
  355. struct IntuiMessage *imsg;           /* IntuiMessage stuff */
  356. ULONG klass;
  357. UWORD code;
  358. APTR iaddress;
  359.  
  360. BOOL done = FALSE;                   /* program termination flag */
  361. /*-----------------------------------------------------------------------*/
  362. void main(void)
  363. {
  364.   /* lets open the famous library :-) */
  365.   if (GadUtilBase = OpenLibrary(GADUTILNAME, 36))
  366.   {
  367.     /* lets get pointer to any public screen */
  368.     if (myscreen = LockPubScreen(NULL))
  369.     {
  370.       /* lets initialize our pretty gadgets */
  371.       if (ginfo = GU_LayoutGadgetsA(&glist, gadgets, myscreen, global_tags))
  372.       {
  373.         /* I think it would be great to have one small cute window ! */
  374.         if (mywindow = OpenWindowTags(
  375.         NULL,
  376.         WA_Left,         5,
  377.         WA_Top,          20,
  378.         WA_InnerWidth,   farright+LEFT_OFFSET,
  379.         WA_InnerHeight,  farbottom+TOP_OFFSET,
  380.         WA_IDCMP,        gad_IDCMP|
  381.                          IDCMP_CLOSEWINDOW|
  382.                          IDCMP_VANILLAKEY,
  383.         WA_Flags,        WFLG_DRAGBAR|
  384.                          WFLG_DEPTHGADGET|
  385.                          WFLG_CLOSEGADGET|
  386.                          WFLG_SMART_REFRESH|
  387.                          WFLG_ACTIVATE|
  388.                          WFLG_RMBTRAP,
  389.         WA_Gadgets,      glist,
  390.         WA_Title,        (ULONG)"Test gadgets.",
  391.         TAG_DONE))
  392.         {
  393.           /* Hmm, our pretties need to be refreshed... */
  394.           GU_RefreshWindow(mywindow, ginfo);
  395.  
  396.           /*
  397.           As ya may see program will terminate if our boolean become TRUE !
  398.           */
  399.           while (!done)
  400.           {
  401.             /* Waiting for messages - is it heavy work ? */
  402.             Wait(1L << mywindow->UserPort->mp_SigBit);
  403.  
  404.             /* lets process our messages */
  405.             while (imsg = GU_GetIMsg(mywindow->UserPort))
  406.             {
  407.               /* Lets store every message and reply as fast as we can ! */
  408.               klass    = imsg->Class;
  409.               code     = imsg->Code;
  410.               iaddress = imsg->IAddress;
  411.               GU_ReplyIMsg(imsg);
  412.  
  413.               /*
  414.               Let's  take  a brave decission and branch out (standard IDCMP
  415.               handling).
  416.               */
  417.               switch (klass)
  418.               {
  419.                 /* DRAWER_KIND, FILE_KIND or IMAGE_KIND */
  420.  
  421.                 case IDCMP_GADGETUP:
  422.  
  423.                       /* number of the selected gadget */
  424.                       sel_gadID = ((struct Gadget *)iaddress)->GadgetID;
  425.  
  426.                   switch (sel_gadID)
  427.                   {
  428.                     case GDG_BUTTON2:
  429.                                             gadgetaddr = GU_GetGadgetPtr(GDG_ONTIME, gadgets);    /* Get a pointer for the gadget */
  430.  
  431.                                             if (gadgetaddr->pg_Current>=5)                                            /* Decrement the progress gadget */
  432.                                                 gadgetaddr->pg_Current=gadgetaddr->pg_Current-5;    /* (IF possible) */
  433.  
  434.                                             GU_UpdateProgress(mywindow,ginfo,gadgetaddr);                /* And update the gadget itself */
  435.  
  436.                                             break;
  437.  
  438.                     case GDG_BUTTON3:
  439.  
  440.                                             gadgetaddr = GU_GetGadgetPtr(GDG_ONTIME, gadgets);    /* Pointer to the PROGRESS_KIND gadget */
  441.  
  442.                                             if (gadgetaddr->pg_Current<=95)                                            /* Increment the progress gadget. */
  443.                                                 gadgetaddr->pg_Current=gadgetaddr->pg_Current+5;    /* (IF possible) */
  444.  
  445.                                             GU_UpdateProgress(mywindow,ginfo,gadgetaddr);                /* And update the gadget */
  446.  
  447.                       break;
  448.                                     }
  449.  
  450.                     break;
  451.  
  452.                    /* both close window and Esc key will cause quit */
  453.                    case IDCMP_CLOSEWINDOW: done = TRUE; break;
  454.                    case IDCMP_VANILLAKEY:  done = (code==27); break;
  455.               }
  456.             }
  457.           }
  458.           /* Bye, bye dear window ! */
  459.           CloseWindow(mywindow);
  460.         }
  461.         /* Bye for now, pretty gadgets ! */
  462.         GU_FreeLayoutGadgets(ginfo);
  463.       }
  464.             
  465.       /* According to the RKM we may unlock our screen now ! */
  466.       UnlockPubScreen(NULL, myscreen);
  467.  
  468.     }
  469.     /* Sorry, according to the RKM I... have to close ya :( */
  470.     CloseLibrary(GadUtilBase);
  471.   }
  472. }
  473.